package com.heima.admin.controller;

import com.heima.admin.annotation.OperationFill;
import com.heima.admin.service.WmNewsArtificialService;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.IsPassDto;
import com.heima.model.wemedia.dtos.NewsAuthDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@Slf4j
public class WmNewsArtificialController {

    private final WmNewsArtificialService wmNewsArtificialService;

    /** 进行人工审核文章列表查询 */
    @OperationFill
    @PostMapping("/api/v1/news/list_vo")
    public ResponseResult listVo(@RequestBody NewsAuthDto dto){
        log.info("进行人工审核列表查询：{}",dto);
        return wmNewsArtificialService.list(dto);
    }

    /** 查询文章详情 */
    @OperationFill
    @GetMapping("/api/v1/news/one_vo/{id}")
    public ResponseResult findOne(@PathVariable Integer id){
        log.info("查询文章详情:{}",id);
        return wmNewsArtificialService.findOne(id);
    }

    /** 文章审核通过 */
    @OperationFill
    @PostMapping("/api/v1/news/auth_pass")
    public ResponseResult pass(@RequestBody IsPassDto dto){
        log.info("通过：{}",dto);
        return wmNewsArtificialService.pass(dto);
    }

    /** 文章审核通过 */
    @OperationFill
    @PostMapping("/api/v1/news/auth_fail")
    public ResponseResult noPass(@RequestBody IsPassDto dto){
        log.info("不通过：{}",dto);
        return wmNewsArtificialService.pass(dto);
    }
}
